package com.example.booksystem.demos.web.controller;

import com.example.booksystem.demos.web.model.User;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;

@RequestMapping("/user")
@RestController
public class userController {

    @RequestMapping("/login")
    public boolean login(User user, HttpSession session){
        System.out.println("doLogin");
        if(user!=null){
            if("zzzyh".equals(user.getUserName()) && "123456".equals(user.getPassword())){
                session.setAttribute("user",user);
                return true;
            }
        }

        return false;
    }
}
